Borg: a way to hapiness in distributed environments
differences with Pico

Part #1: Added Functionality

Part #2: Interpreter Changes

Part #3: Work Method & Tools

Part #4: Missing Functionality

Added functionality

Location Transparent Router

router_bind, router_unbind, ...

Serialiser & Deserialiser

ser, deser, ...

Agents = processes

newagent, agentclone, agentmove, ...

Load & Save operators

loadexp, saveexp, load

File primitives

fwrite, fopen,...

Added Symbols

_EXP_TYPE_ _ag_make_ref_(_STR_TYPE_ str)

_STR_TYPE_ _ag_get_ref_(_EXP_TYPE_ exp)

symbol("test") ~ read("test")

"test" !~ symbol("test")

Added Eval & Quote

- eval(<expression>, <dictionary>)

evaluates expression in the given dictionary

- quote(test:=5)

returns an unevaluated argument:

<assignment test>

Part #1: Added Functionality

Part #2: Interpreter Changes

Part #3: Work Method & Tools

Part #4: Missing Functionality

Natives transfer

Display and 23 thunks are removed

(written in pico)

Print and 23 thunks are removed

(written in pico)

Identity operators has been removed

(written in pico)

Natives Easier to Implement

Only one table to update: Natives.h

NATIVE is used to define a new native

THUNK is used to specify a thunk which can be used afterwards

Natives Easier to Implement

...

/* ARITHMETIC */\

NATIVE(ADD,"+")	THUNK(AD1)	THUNK(AD2)\

NATIVE(SUB,"-")	THUNK(SU1)	THUNK(SU2)\

NATIVE(MUL,"*")	THUNK(MU1)\

NATIVE(DIV,"/")	THUNK(DI1)\

NATIVE(IDV,"/""/")	THUNK(ID1)\

NATIVE(REM,"\\""\\")	THUNK(RE1)\

NATIVE(POW,"^")	THUNK(PO1)\

/* RELATIONAL */\

NATIVE(LSS,"<")	THUNK(LS1)\

NATIVE(LEQ,"<=")	THUNK(LE1)\

NATIVE(EQL,"=")	THUNK(EQ1)\

...

User Interface Link

C A L L B A C K S F R O M B O R G

void _ui_print_(int ui, char* text);

void _ui_display_(int ui, char*);

void _ui_mark_(int ui, int start, int stop);

void _ui_error_(int ui,char* str);

void _ui_reclaim_(int);

char* _ui_accept_(int ui, char* prompt);

ccc _ui_call_(int ui, int cal, int siz, ccc[] args);

void _ui_log_(char* debugmsg);

char* _ui_debug_in_(char* prompt);

void _ui_debug_out_(char* msg);

void _ui_die_(int ui);

void _ui_name_(int ui, char* name);

User Interface Link

C A L L S T O B O R G

char* _borg_init_(void*, long);

void _borg_new_(int ui);

void _borg_do_(int ui, char* exptxt);

void _borg_step_();

void _borg_reset_();

void _borg_close_(int ui);

void _borg_finish_();

Scanner written with Lex

...

:	{return COLt;}

::	{return CCLt;}

:=	{return CEQt;}

;	{return SMCt;}

,	{return COMt;}

\.	{return PERt;}

[0-9]+	{NUM;}

[0-9]*\.[0-9]+	{FRC;}

[0-9]+[eE][+-]?[0-9]+	{FRC;}

[0-9]*\.[0-9]+[eE][+-]?[0-9]+	{FRC;}

[A-Za-z_][_A-Za-z0-9_]*	{NAM(NAMt);}

[\!\^\?][#<>=\*\/\\\$\%\|\~\+\-\!\^\?]*	{NAM(XOPt);}

[\$\%\|\~\+-][#<>=\*\/\\\$\%\|\~\+\-\!\^\?]*	{NAM(AOPt);}

[&\*\/\\][#<>=\*\/\\\$\%\|\~\+\-\!\^\?]*	{NAM(MOPt);}

[#<>=][#<>=\*\/\\\$\%\|\~\+\-\!\^\?]*	{NAM(ROPt);}

...

Parser written with Yacc

EXP:	INVOCATION	{$$=$1;}

| DEFINITION	{$$=$1;}

| DECLARATION	{$$=$1;}

| ASSIGNMENT	{$$=$1;}

DEFINITION:	INVOCATION COLt EXP

{$$=_ag_make_DEF_($1,$3);}

DECLARATION:	INVOCATION CCLt EXP

{$$=_ag_make_DCL_($1,$3);}

ASSIGNMENT:	INVOCATION CEQt EXP

{$$=_ag_make_SET_($1,$3);}

Benefits

Problems with the Pico parser

- uses global variables, state capture impossible

- a garbage collect while parsing is deadly

Benefits of the Borg parser

-easy to understand

- easy to modify

- automatically optimised non-ascii parser

- not thunk based, state capture is no problem

Startup Files

Borg will NOT boot if borg.system.boot cannot be loaded.

borg.system.boot

borg.abstractgrammar.boot	identity operators

borg.timers.boot	timer operators

borg.agent.boot	agent operations

borg.interfacing.boot	display, print, ...

borg.lists.boot	list operators

borg.communication.boot	send, sync, recv

Symbol creation is faster

Checking for the existence of the name

O(log2n) vs O(n/2)

Adding the name

O(n/2)

Added Frames

-Define of an existing variable = assignment

-Frames are seperated by a sentinel called '[dctname]'. This value is used to export a remote reference.

Part #1: Added Functionality

Part #2: Interpreter Changes

Part #3: Work Method & Tools

Part #4: Missing Functionality

Internal Debugging Support

_NIL_TYPE_ _log_(str, args, ...)

_NIL_TYPE_ _exp_print_(_EXP_TYPE_ exp)

_NIL_TYPE_ _dct_print_(_EXP_TYPE_ exp)

Debugging output is

1) written to stderr

2) send to the user interface

3) written to a logfile

Memory Selftest

Defining MEMORY_SELFTEST1 creates a memory module which reallocates all chunks when a mem_claim is done !

This guarantees that no expression stored in C (stack, heap, ...) is passed over a mem_claim.

When a memory overflow occurs a readable memory_dump is printed.

Platform Independence

All files include only 1 file. If other files are needed a define should be set. Eg: If Dictionaries are needed NeedDictionaries should be defined.

AllHeaders.h will always include StdHeaders.h

StdHeaders.h will either include StdPalm.h, StdLinux.h, StdWindows, StdMacintosh.h

StdPlatform.c will include StdPalm.c, StdLinux.c, StdWindows.c, StdMacintosh.c

Core Test

The core test is a borg program which should contain

- bugs from the past

- tests for pico-compatibility

- possible selftests (eg: tailrecursion)

Coretest is set up in a modular way

Cvs Repository

#developpers = 1

- fix bugs, compile, package

-send out a copy to all registered users.

#developpers > 1

- fix bugs, compile, package

- send out a prerelease to all co-developpers

- oops they changed something themselve

- merge differences

- try again a new prerelease

- oops somebody else change something.

- ...

Cvs Repository

1. All clients have a local working copy

2. Before starting to work update your local copy

cvs update

3. Do some work

4. make all, do core regression tests

5. commit your local working copy to the repository

cvs commit

[6. Conflicts are reported and marked in the source]

[7. Merge them manually and commit again]

Clients available for Windows, Unix systems, Macintosh

Borg Repository Layout

cborgcore	- the evaluator

bborgcore	- the evaluator written in borg

config	- bootfiles, configuration files

kborg	- Kde1 user interface

pborg	- Palm user interface

wborg	- Windows user interface

mborg	- Macintosh user interface

tborg	- Text ''user interface''

documenation	- website, papers, presentations ...

examples	- coretest and other examples

Website Layout

Website (http://borg.rave.org/) is also stored in the repository

About	-changelog automatically added

Mailing List	-cborg@prog2.vub.ac.be

Downloads	-ftp site with binaries

Examples	-automatically .html-ified .borg

Bugtracking	-jitterbug

Sources	-repository, cross referencer

Research	-papers, presentations, thesissen

Part #1: Added Functionality

Part #2: Interpreter Changes

Part #3: Work Method & Tools

Part #4: Missing Functionality

B%rg Objects

A clone operator which returns the current dictionary.

No dynamic scoping,

only lexical scoping, hence

- no variable overriding

- no method overriding

Capture/ Restore

< not yet incorporated >

2001-12-02T16:12:08